﻿using System.Collections.Generic;
using System.Text;

namespace DatabaseGroup.SSIS.SourceAdapters.Model
{
    /// <summary>
    /// Provides functionality regarding source file access and configuration
    /// </summary>
    public interface ISourceFileModel
    {
        /// <summary>
        /// Gets or sets the full file name of the source file
        /// </summary>
        string FileName { get; set; }

        /// <summary>
        /// Gets or sets the encoding used for reading file data
        /// </summary>
        Encoding Encoding { get; set; }

        /// <summary>
        /// Gets or sets the source file column delimiter
        /// </summary>
        string ColumnDelimiter { get; set; }

        /// <summary>
        /// Gets or sets the source file row delimiter
        /// </summary>
        string RowDelimiter { get; set; }

        /// <summary>
        /// Gets or sets if the first data row contains the column names
        /// </summary>
        bool ColumnNamesInFirstRow { get; set; }

        /// <summary>
        /// Gets or sets the number of initial data rows to skip
        /// before reading data
        /// </summary>
        int DataRowsToSkip { get; set; }

        /// <summary>
        /// Gets or sets the header row delimiter
        /// </summary>
        string HeaderRowDelimiter { get; set; }

        /// <summary>
        /// Gets or sets the number of initial header rows to skip before
        /// reading data rows
        /// </summary>
        int HeaderRowsToSkip { get; set; }

        /// <summary>
        /// Gets or sets the text qualifier to use for encapsulating column data
        /// </summary>
        string TextQualifier { get; set; }

        /// <summary>
        /// Gets a number of rows from the source file
        /// </summary>
        /// <param name="offset">The number of initial data rows to skip</param>
        /// <param name="limit">The maximum number of rows to return</param>
        /// <param name="skipAllInitialRows">
        /// True if all initial header/data rows should be skipped, 
        /// false if only initial header rows should be skipped
        /// </param>
        /// <remarks>
        /// Hides any errors when reading file data because at this
        /// stage we don't care about file errors - only during execution
        /// </remarks>
        /// <returns>The list of rows, each containing a list of column data</returns>
        List<string[]> GetRows(int offset, int limit, bool skipAllInitialRows);
    }
}
